home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume90 / comm / dial_1.2
Encoding:
Internet Message Format  |  1990-01-18  |  22.6 KB

  1. Path: xanth!cs.odu.edu!Amiga-Request
  2. From: Amiga-Request@cs.odu.edu (Amiga Sources/Binaries Moderator)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v90i027: dial.vt100 1.2 - ARexx "Dialing Directory" for use with VT100 2.9, Part01/01
  5. Message-ID: <11040@xanth.cs.odu.edu>
  6. Date: 18 Jan 90 00:52:09 GMT
  7. Sender: tadguy@cs.odu.edu
  8. Reply-To: dwl10@uts.amdahl.com (Dave Lowrey)
  9. Lines: 744
  10. Approved: tadguy@cs.odu.edu (Tad Guy)
  11.  
  12. Submitted-by: dwl10@uts.amdahl.com (Dave Lowrey)
  13. Posting-number: Volume 90, Issue 027
  14. Archive-name: comm/dial-1.2
  15.  
  16. dial.vt100 - An ARexx "Dialing Directory" script for use with VT100 (v2.9).
  17.  
  18. dial.vt100 allows the user to store up to 20 frequently called phone
  19. numbers. When selected, dial.vt100 will have your modem automatically
  20. call the desired number.
  21.  
  22. dial.vt100 requires the following:
  23.   - VT100 terminal program (version 2.9 or higher)
  24.   - ARexx
  25.   - arp.library
  26.   - rexxarplib.library
  27.  
  28. VT100, arp.library and rexxarplib.library are avaliable on various
  29. archives, FISH disks, and other public sources.
  30.  
  31. Author: David W. Lowrey  (dwl10@uts.amdahl.com or amdahl!dwl10)
  32.  
  33. #!/bin/sh
  34. # This is a shell archive.  Remove anything before this line, then unpack
  35. # it by saving it into a file and typing "sh file".  To overwrite existing
  36. # files, type "sh file -c".  You can also feed this as standard input via
  37. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  38. # will see the following message at the end:
  39. #        "End of archive 1 (of 1)."
  40. # Contents:  dial.doc dial.vt100
  41. # Wrapped by tadguy@xanth on Wed Jan 17 19:51:58 1990
  42. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  43. if test -f 'dial.doc' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'dial.doc'\"
  45. else
  46. echo shar: Extracting \"'dial.doc'\" \(2229 characters\)
  47. sed "s/^X//" >'dial.doc' <<'END_OF_FILE'
  48. X
  49. X dial.vt100 - An ARexx "Dialing Directory" for use with VT100 (V2.9 or higher)
  50. X
  51. X Author: David W. Lowrey
  52. X     dwl10@uts.amdahl.com or amdahl!dwl10
  53. X     (713)-894-7447 (home)
  54. X     (713)-850-8828 (work)
  55. X
  56. X    Version 1.2: Jan 15, 1990
  57. X
  58. X    This program allows the user to save up to 20 frequently used
  59. X    phone numbers. The program will dial the phone number, at the
  60. X    request of the user. Each number has 7 fields associated with it.
  61. X    They are:
  62. X
  63. X    Name:    An ascii string describing the number.
  64. X    Phone:   The actual phone number to be dialed
  65. X    Baud:    The Baud Rate that VT100 should be set to when dialing this number
  66. X    Parity:  The Parity that VT100 should be set to when dialing this number
  67. X    Prefix:  A string that is sent to the modem BEFORE dialing the number
  68. X    Postfix: A string that is sent to the modem AFTER dialing the number,
  69. X         A carrige return is signified by "^M".
  70. X    Script:  The name of an ARexx script to be called. This script is passed
  71. X         the above mentioned parameters. When a user's script is called,
  72. X         this script exit's. All dialing must be done by the user's script.
  73. X         This script launches the user's script via VT100's RX command.
  74. X         Therfore, the user's script must end in '.vt100'.
  75. X
  76. X    The phone file defaults to S:VT100.phones. If it doesn't exist, dial
  77. X    will use default values for all fields.
  78. X
  79. X    To install: Copy dial.vt100 to REXX:dial.vt100
  80. X        Makesure the following files are in LIBS:
  81. X         - arp.library
  82. X         - rexarplib.library
  83. X
  84. X    To run: either directly execute from the VT100 "REXX MACRO" menu, or
  85. X    issue the "RX DIAL" script command.
  86. X
  87. X
  88. X    This program requires:
  89. X       VT100 Version 2.9 (Released October-89)
  90. X       ARexx
  91. X       arp.library     (PD routines)
  92. X       rexarplib.library (PD routines, necessary for windowing)
  93. X
  94. X    VT100, arp.library,  and rexarplib.library are avaliable in many
  95. X    PD collections.
  96. X
  97. X    ARexx is a licensed program, written by William S. Hawes
  98. X
  99. X
  100. X    Future enhancements?
  101. X     - Adjust number of entries in list acording to the size of
  102. X       the user's screen (more entries if using interlace).
  103. X
  104. X     - Be able to read the dialing directories of other terminal
  105. X       programs.
  106. X
  107. X     - Any other suggestions would be welcome.
  108. X
  109. END_OF_FILE
  110. if test 2229 -ne `wc -c <'dial.doc'`; then
  111.     echo shar: \"'dial.doc'\" unpacked with wrong size!
  112. fi
  113. # end of 'dial.doc'
  114. fi
  115. if test -f 'dial.vt100' -a "${1}" != "-c" ; then 
  116.   echo shar: Will not clobber existing file \"'dial.vt100'\"
  117. else
  118. echo shar: Extracting \"'dial.vt100'\" \(17156 characters\)
  119. sed "s/^X//" >'dial.vt100' <<'END_OF_FILE'
  120. X/*
  121. X * dial.vt100 - An ARexx script for use with VT100 (V2.9 or higher)
  122. X *
  123. X *    This program allows the user to save up to 20 frequently used
  124. X *    phone numbers. The program will dial the phone number, at the
  125. X *    request of the user. Each number has 7 fields associated with it.
  126. X *    They are:
  127. X *
  128. X *    Name:    An ascii string describing the number.
  129. X *    Phone:   The actual phone number to be dialed
  130. X *    Baud:    The Baud Rate that VT100 should be set to when dialing this number
  131. X *    Parity:  The Parity that VT100 should be set to when dialing this number
  132. X *    Prefix:  A string that is sent to the modem BEFORE dialing the number
  133. X *    Postfix: A string that is sent to the modem AFTER dialing the number,
  134. X *           A carrige return is signified by "^M".
  135. X *    Script:  The name of an ARexx script to be called. This script is passed
  136. X *           the above mentioned parameters. When a user's script is called,
  137. X *           this script exit's. All dialing must be done by the user's script.
  138. X *           This script launches the user's script via VT100's RX command.
  139. X *           Therfore, the user's script must end in '.vt100'.
  140. X *
  141. X *    The phone file defaults to S:VT100.phones. If it doesn't exist, dial
  142. X *    will use default values for all fields.
  143. X *
  144. X *    To install: just copy this file to REXX:dial.vt100
  145. X *
  146. X *    To run: either directly execute from the VT100 "REXX MACRO" menu, or
  147. X *    issue the "RX DIAL" script command.
  148. X *
  149. X *
  150. X *    This program requires:
  151. X *     VT100 Version 2.9 (Released October-89)
  152. X *     ARexx
  153. X *     arp.library       (PD routines)
  154. X *     rexarplib.library (PD routines, necessary for windowing)
  155. X *
  156. X *    VT100, arp.library,  and rexarplib.library are avaliable in many
  157. X *    PD collections.
  158. X *
  159. X *    ARexx is a licensed program, written by William S. Hawes
  160. X *
  161. X ****************************************************************************
  162. X *    dial.vt100 - Copyright 1989 by Starbound Computing, a division of
  163. X *           Starbound Enterprizes.
  164. X *
  165. X *         - Written by David W. Lowrey (USENET: amdahl!dwl10)
  166. X *
  167. X *           THIS PROGRAM IS NOT IN THE PUBLIC DOMAIN!!!
  168. X *
  169. X *  All Rights Reserved. This program may be freely used and copied, as long
  170. X *  as no fee, other than a "reasonable" copying charge, is charged for
  171. X *  it's use.
  172. X *
  173. X *  Permission is granted to include this program in various user group PD
  174. X *  collections, the FISH PD collection, or private PD collections.
  175. X *
  176. X *  Inclusion in and commercial PD disk collections, including Magazine
  177. X *  disks, requires written permission from the author.
  178. X *
  179. X *  Any use for comercial purposes requires written permission
  180. X *  from the author.
  181. X *
  182. X */
  183. X
  184. X/*
  185. X * Version 1.2:  Striped off extra blanks from dial strings before sending
  186. X *         them to VT100 (the modem).
  187. X *
  188. X * Version 1.1:  Cleaned up code.
  189. X *
  190. X * Version 1.0:  Initial public release
  191. X */
  192. X
  193. X/*
  194. X * default values
  195. X *
  196. X * feel free to change any of these
  197. X * Note that the default name must be exactly 25 characters long
  198. X */
  199. Xdefault.name = "                         "
  200. Xdefault.phone = " "
  201. Xdefault.baud = "2400"
  202. Xdefault.parity = "NONE"
  203. Xdefault.prefix = "ATDT"
  204. Xdefault.postfix = "^M"     /* carrage return after dial string */
  205. Xdefault.script = " "
  206. X
  207. X/*
  208. X * Make sure the required libraries have been loaded
  209. X */
  210. Xif ~show('l', "rexxarplib.library") then do
  211. X   check = addlib('rexxarplib.library',0,-30,0)
  212. X   if ~check then do
  213. X      say "Can't load rexxarplib.library!"
  214. X      exit -1
  215. X   end
  216. X   else nop
  217. Xend
  218. Xelse nop
  219. X
  220. Xif ~show('l', "rexxsupport.library") then do
  221. X   check = addlib('rexxsupport.library',0,-30,0)
  222. X   if ~check then do
  223. X      say "Can't load rexxsupport.library!"
  224. X      exit -1
  225. X   end
  226. X   else nop
  227. Xend
  228. Xelse nop
  229. X
  230. X/*
  231. X * Create the window manager process
  232. X */
  233. Xaddress command run "rx 'call CreateHost(DIALWIN,DIALPORT)'"
  234. Xaddress command "waitforport DIALWIN" /* wait for port to come active */
  235. X
  236. X/*
  237. X *   Window sizes
  238. X */
  239. Xwindow.leftedge = 50
  240. Xwindow.topedge    = 0
  241. Xwindow.width    = 470
  242. Xwindow.height    = 200
  243. X
  244. X/*
  245. X * Initialize data values
  246. X */
  247. Xnames.        = default.name
  248. Xphones.     = default.phone
  249. Xbaud.        = default.baud
  250. Xparity.     = default.parity
  251. Xprefix.     = default.prefix
  252. Xpostfix.    = default.postfix
  253. Xscript.     = default.script
  254. X
  255. Xsavefile    = "S:VT100.phones"
  256. X
  257. Xmod.=""
  258. X
  259. Xgadget.previous=0
  260. Xmodified=0
  261. X
  262. Xcall OpenWin1
  263. X
  264. X/* Open our host port */
  265. Xcall openport(DIALPORT)
  266. X
  267. X/*
  268. X * read in the phone directory
  269. X */
  270. Xcall ReadPhone
  271. X
  272. Xcall DrawScreen1
  273. X
  274. X/*
  275. X *   Wait for messages at DIALPORT
  276. X */
  277. Xquitflag = 0
  278. Xdo forever until quitflag
  279. X   call waitpkt(DIALPORT)
  280. X   p = getpkt(DIALPORT)
  281. X   if p ~== '0000 0000'x then
  282. X      do
  283. X
  284. X      thisarg = getarg(p)
  285. X      gadgetnum = getarg(p,1)
  286. X      t=reply(p, 0)
  287. X
  288. X/*
  289. X * Decode the IDCMP message
  290. X */
  291. X
  292. X      select
  293. X      /*
  294. X       *   Messages are either CLOSEWINDOW
  295. X       */
  296. X     when thisarg == 'CLOSEWINDOW' then do
  297. X        if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
  298. X        else reply="OKAY"
  299. X        if reply == "OKAY" then do
  300. X           call CloseWindow(DIALWIN)
  301. X           quitflag = 1
  302. X        end
  303. X        else nop
  304. X     end
  305. X      /*
  306. X       *   ...or one of the Phone Number gadgets has been selected
  307. X       */
  308. X     when thisarg == 'Gadget' then do
  309. X        gadget.current = gadgetnum
  310. X
  311. X        if gadget.current == gadget.previous then do
  312. X           call SetGadget(DIALWIN, gadget.current, "OFF")
  313. X           gadget.previous=0
  314. X           gadget.current=0
  315. X        end
  316. X        else do
  317. X           call SetGadget(DIALWIN, gadget.current, "ON")
  318. X           if gadget.previous ~== 0 then call SetGadget(DIALWIN, gadget.previous, OFF)
  319. X           gadget.previous=gadget.current
  320. X        end
  321. X
  322. X     end
  323. X      /*
  324. X       *   ...or the LOAD Gadget has been selected
  325. X       */
  326. X
  327. X     when thisarg == 'Load' then do
  328. X        if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
  329. X        else reply="OKAY"
  330. X        if reply == "OKAY" then do
  331. X           newsave=Request(140,40,"     LOAD PHONE FILE\\Enter name of phone file",savefile,"Okay","Cancel")
  332. X           if newsave ~= "" then do
  333. X          if exists(newsave) then do
  334. X             savefile=newsave
  335. X             call ReadPhone
  336. X             call CloseWindow(DIALWIN,"CONTINUE")
  337. X             call OpenWin1
  338. X             call DrawScreen1
  339. X             modified=0
  340. X          end
  341. X          else do
  342. X             t=Request(140,40,"Phone file not found\Load request canceled",,"Okay",)
  343. X          end
  344. X           end
  345. X           else nop
  346. X        end
  347. X        else nop
  348. X     end
  349. X
  350. X      /*
  351. X       * ...or the SAVE gadget has been selected
  352. X       */
  353. X
  354. X     when thisarg == 'Save' then do
  355. X        newsave=Request(140,40,"     SAVE PHONE FILE\\Enter name of phone file",savefile,"Okay","Cancel")
  356. X        if newsave ~= "" then do
  357. X           savefile=newsave
  358. X           call SavePhone
  359. X           modified=0
  360. X        end
  361. X        else nop
  362. X     end
  363. X      /*
  364. X       *   ...or the DELETE gadget has been selected
  365. X       */
  366. X
  367. X     when thisarg == 'Delete' then do
  368. X        if gadget.current ~= 0 then do
  369. X           index=gadget.current
  370. X           t=Request(140,40,"     DELETE ENTRY\\"names.index"\\is about to be deleted\Please confirm:",,"Okay","Cancel")
  371. X           if t == "OKAY" then do
  372. X          names.index="                         "
  373. X          phones.index="                         "
  374. X          baud.index="2400"
  375. X          parity.index="NONE"
  376. X          prefix.index="                         "
  377. X          postfix.index="                         "
  378. X          script.index="                         "
  379. X          call CloseWindow(DIALWIN,"CONTINUE")
  380. X          call OpenWin1
  381. X          call DrawScreen1
  382. X          gadget.current=0
  383. X          gadget.previous=0
  384. X          modified=1
  385. X           end
  386. X           else nop
  387. X        end
  388. X        else nop
  389. X     end
  390. X
  391. X      /*
  392. X       *   ...or MODIFY has been selected
  393. X       */
  394. X
  395. X      when thisarg == 'Modify' then do
  396. X     if gadget.current ~= 0 then do
  397. X        result=modify(gadget.current)
  398. X        if result == 'Okay' then do
  399. X           i = gadget.current
  400. X           names.i = mod.names
  401. X           phones.i = mod.phones
  402. X           baud.i = mod.baud
  403. X           parity.i = mod.parity
  404. X           prefix.i = mod.prefix
  405. X           postfix.i = mod.postfix
  406. X           script.i = mod.script
  407. X           modified = 1
  408. X        end
  409. X        else nop
  410. X
  411. X        call CloseWindow(DIALWIN,"CONTINUE")
  412. X        call OpenWin1
  413. X        call DrawScreen1
  414. X        call SetGadget(DIALWIN,gadget.current, "ON")
  415. X     end
  416. X     else nop
  417. X      end
  418. X
  419. X      /*
  420. X       *   ...or the Dial gadget
  421. X       */
  422. X     when thisarg == 'Dial' then do
  423. X        if gadget.current ~= 0 then do
  424. X           if modified=1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
  425. X           else reply="OKAY"
  426. X           if reply == "OKAY" then do
  427. X          i=gadget.current
  428. X          if strip(script.i) = "" then do
  429. X             dial.prefix=strip(prefix.i)
  430. X             dial.phones=strip(phones.i)
  431. X             dial.postfix=strip(postfix.i)
  432. X             'BAUD 'baud.i
  433. X             'PARITY 'parity.i
  434. X             'SEND "'dial.prefix||dial.phones||dial.postfix'"'
  435. X          end
  436. X          else do
  437. X          /*
  438. X           * Launch user's script as a seperate task
  439. X           * we will end this script now.
  440. X           */
  441. X             'rx 'script.i names.i" "phones.i" "baud.i" "parity.i" "prefix.i" "postfix.i
  442. X          end
  443. X          quitflag = 1
  444. X          call CloseWindow(DIALWIN)
  445. X           end
  446. X           else nop
  447. X        end
  448. X        else nop
  449. X     end
  450. X
  451. X      /*
  452. X       *   ...or an unknown IDCMP msg has been received
  453. X       */
  454. X
  455. X     otherwise do
  456. X        say thisarg
  457. X     end
  458. X      end
  459. X   end
  460. X   else nop
  461. Xend
  462. X
  463. Xexit
  464. X
  465. X/*
  466. X *   Open a window
  467. X */
  468. XOpenWin1:
  469. Xidcmp = 'CLOSEWINDOW+GADGETUP'
  470. Xflags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH'
  471. Xcall OpenWindow(DIALWIN, window.leftedge, window.topedge, window.width, ,
  472. X        window.height, idcmp, flags)
  473. XCall ModifyHost(DIALWIN, 'CLOSEWINDOW',"CLOSEWINDOW%1DUMMY")
  474. Xreturn
  475. X
  476. X/*
  477. X *    Draw the phone book screen
  478. X */
  479. XDrawScreen1: PROCEDURE expose names.
  480. Xcall SetAPen(DIALWIN, 1)
  481. Xcall AddGadget(DIALWIN, 15, 15, 1, names.1, "Gadget%1%d")
  482. Xcall AddGadget(DIALWIN, 15, 30, 2, names.2, "Gadget%1%d")
  483. Xcall AddGadget(DIALWIN, 15, 45, 3, names.3, "Gadget%1%d")
  484. Xcall AddGadget(DIALWIN, 15, 60, 4, names.4, "Gadget%1%d")
  485. Xcall AddGadget(DIALWIN, 15, 75, 5, names.5, "Gadget%1%d")
  486. Xcall AddGadget(DIALWIN, 15, 90, 6, names.6, "Gadget%1%d")
  487. Xcall AddGadget(DIALWIN, 15, 105, 7, names.7, "Gadget%1%d")
  488. Xcall AddGadget(DIALWIN, 15, 120, 8, names.8, "Gadget%1%d")
  489. Xcall AddGadget(DIALWIN, 15, 135, 9, names.9, "Gadget%1%d")
  490. Xcall AddGadget(DIALWIN, 15, 150, 10, names.10, "Gadget%1%d")
  491. Xcall AddGadget(DIALWIN, 245, 15, 11, names.11, "Gadget%1%d")
  492. Xcall AddGadget(DIALWIN, 245, 30, 12, names.12, "Gadget%1%d")
  493. Xcall AddGadget(DIALWIN, 245, 45, 13, names.13, "Gadget%1%d")
  494. Xcall AddGadget(DIALWIN, 245, 60, 14, names.14, "Gadget%1%d")
  495. Xcall AddGadget(DIALWIN, 245, 75, 15, names.15, "Gadget%1%d")
  496. Xcall AddGadget(DIALWIN, 245, 90, 16, names.16, "Gadget%1%d")
  497. Xcall AddGadget(DIALWIN, 245, 105, 17, names.17, "Gadget%1%d")
  498. Xcall AddGadget(DIALWIN, 245, 120, 18, names.18, "Gadget%1%d")
  499. Xcall AddGadget(DIALWIN, 245, 135, 19, names.19, "Gadget%1%d")
  500. Xcall AddGadget(DIALWIN, 245, 150, 20, names.20, "Gadget%1%d")
  501. Xcall Move(DIALWIN,0,165)
  502. Xcall SetAPen(DIALWIN, 3)
  503. Xcall Draw(DIALWIN, 470, 165)
  504. Xcall Flood(DIALWIN, 1, 13, 13)
  505. Xcall Move(DIALWIN,50,175)
  506. Xcall SetAPen(DIALWIN, 1)
  507. Xcall Text(DIALWIN, "Select a destination, then select a function.")
  508. Xcall AddGadget(DIALWIN, 30,180, 21, "DIAL", "Dial%1dummy")
  509. Xcall AddGadget(DIALWIN, 100, 180, 22, "MODIFY", "Modify%1dummy")
  510. Xcall AddGadget(DIALWIN, 175, 180, 23, "DELETE", "Delete%1dummy")
  511. Xcall AddGadget(DIALWIN, 250, 180, 24, "LOAD", "Load%1dummy")
  512. Xcall AddGadget(DIALWIN, 325, 180, 25, "SAVE", "Save%1dummy")
  513. Xcall AddGadget(DIALWIN, 400, 180, 26, "CANCEL", "CLOSEWINDOW%1dummy")
  514. Xreturn
  515. X
  516. X/*
  517. X * Routine to read a Phonebook File
  518. X */
  519. XReadPhone: procedure expose names. phones. baud. parity. prefix. postfix.,
  520. X                script. savefile sys.
  521. X
  522. Xif exists(savefile) then do
  523. X   t=open(phonebook,savefile,'Read')
  524. X   do index=1 to 20
  525. X      entry=readln(phonebook);
  526. X      parse var entry names.index '\' phones.index '\' baud.index '\',
  527. X              parity.index '\' prefix.index '\' postfix.index '\',
  528. X              script.index
  529. X      names.index=center(names.index,25)
  530. X   end
  531. X   t=close(phonebook)
  532. Xend
  533. Xreturn
  534. X
  535. X/*
  536. X * Routine to write a Phonebook File
  537. X */
  538. XSavePhone: procedure expose names. phones. baud. parity. prefix. postfix.,
  539. X                script. savefile sys.
  540. X
  541. Xt=open(phonebook,savefile,'Write')
  542. Xdo index=1 to 20
  543. X   names.index=strip(names.index)
  544. X   t=writeln(phonebook,names.index'\'phones.index'\'baud.index'\'parity.index'\'prefix.index'\'postfix.index'\'script.index)
  545. Xend
  546. Xt=close(phonebook)
  547. Xreturn
  548. X
  549. X/*
  550. X * modify: Add/Modify a phone entry
  551. X */
  552. Xmodify: procedure expose names. phones. baud. parity. prefix. postfix.,
  553. X                script. mod. window.
  554. X
  555. Xparse arg index
  556. X
  557. Xmod.names   = names.index
  558. Xmod.phones  = phones.index
  559. Xmod.baud    = baud.index
  560. Xmod.parity  = parity.index
  561. Xmod.prefix  = prefix.index
  562. Xmod.postfix = postfix.index
  563. Xmod.script  = script.index
  564. X
  565. Xcall formatmod
  566. X/*
  567. X * Get rid of old window and draw our own
  568. X */
  569. Xcall CloseWindow(DIALWIN, "CONTINUE")
  570. Xcall OpenWin1
  571. X
  572. Xcall AddGadget(DIALWIN, 100, 30,  1, mod.names,   "names%1%g",   208)
  573. Xcall AddGadget(DIALWIN, 100, 50,  2, mod.phones,  "phones%1%g",  208)
  574. Xcall AddGadget(DIALWIN, 100, 70,  3, mod.baud,    "baud%1%g",    40)
  575. Xcall AddGadget(DIALWIN, 100, 90,  4, mod.parity,  "parity%1%g",  48)
  576. Xcall AddGadget(DIALWIN, 100, 110, 5, mod.prefix,  "prefix%1%g",  208)
  577. Xcall AddGadget(DIALWIN, 100, 130, 6, mod.postfix, "postfix%1%g", 208)
  578. Xcall AddGadget(DIALWIN, 100, 150, 7, mod.script,  "script%1%g",  208)
  579. Xcall AddGadget(DIALWIN, 20,  180, 8, "OKAY",      "Okay%1%dummy")
  580. Xcall AddGadget(DIALWIN, 400, 180, 9, "CANCEL",    "CLOSEWINDOW%1dummy")
  581. Xcall SetAPen(DIALWIN, 1)
  582. Xcall Move(DIALWIN,8, 37)
  583. Xcall Text(DIALWIN, "     Name:")
  584. Xcall Move(DIALWIN,8, 57)
  585. Xcall Text(DIALWIN, "    Phone:")
  586. Xcall Move(DIALWIN,8, 77)
  587. Xcall Text(DIALWIN, "     Baud:")
  588. Xcall Move(DIALWIN,8, 97)
  589. Xcall Text(DIALWIN, "   Parity:")
  590. Xcall Move(DIALWIN,8, 117)
  591. Xcall Text(DIALWIN, "   Prefix:")
  592. Xcall Move(DIALWIN,8, 137)
  593. Xcall Text(DIALWIN, "  Postfix:")
  594. Xcall Move(DIALWIN,8, 157)
  595. Xcall Text(DIALWIN, "   Script:")
  596. Xcall Move(DIALWIN, 132, 16)
  597. Xcall Text(DIALWIN, "Modify Desired fields")
  598. Xcall Move(DIALWIN, 50, 24)
  599. Xcall Text(DIALWIN, "You must press "RETURN" to save each field")
  600. X
  601. Xcall ActivateGadget(DIALWIN, 1)
  602. X
  603. X/*
  604. X *   Wait for messages at DIALPORT
  605. X */
  606. Xquitflag = 0
  607. Xgadnum.names = 1
  608. Xgadnum.phones = 2
  609. Xgadnum.baud = 3
  610. Xgadnum.parity = 4
  611. Xgadnum.prefix = 5
  612. Xgadnum.postfix = 6
  613. Xgadnum.script = 7
  614. X
  615. Xdo forever until quitflag
  616. X   call waitpkt(DIALPORT)
  617. X   p = getpkt(DIALPORT)
  618. X   if p ~== '0000 0000'x then
  619. X      do
  620. X
  621. X      thisarg = getarg(p)
  622. X      string = getarg(p,1)
  623. X      t=reply(p, 0)
  624. X
  625. X/*
  626. X * Decode the IDCMP message
  627. X */
  628. X
  629. X      select
  630. X      /*
  631. X       *   Messages are either CLOSEWINDOW ...
  632. X       */
  633. X     when thisarg == 'CLOSEWINDOW' then do
  634. X        if modified = 1 then reply=Request(140, 40,"NOTICE: There are unsaved\changes. Click 'Cancel' to abort.\Click 'Okay' to continue, and\loose all changes.",,"Okay","Cancel")
  635. X        else reply="OKAY"
  636. X        if reply == "OKAY" then do
  637. X           ret="Not Modified"
  638. X           quitflag = 1
  639. X        end
  640. X        else nop
  641. X     end
  642. X
  643. X      /*
  644. X       * ...or "Quit" (exit with new values)
  645. X       */
  646. X     when thisarg == 'Okay' then do
  647. X        if modified == 1 then do
  648. X           call formatmod
  649. X           mod.names=center(strip(mod.names),25)
  650. X           ret = 'Okay'
  651. X        end
  652. X        else ret = 'Not Modified'
  653. X        quitflag = 1
  654. X     end
  655. X
  656. X      /*
  657. X       *   ...or one of the free formstring gadgets has been selected
  658. X       */
  659. X     when thisarg=='names' | thisarg=='phones' | thisarg=='prefix' ,
  660. X          | thisarg=='postfix' | thisarg=='script' then do
  661. X        upperarg=upper(thisarg)
  662. X        if mod.upperarg ~= string then do
  663. X           mod.upperarg = string
  664. X           modified = 1
  665. X        end
  666. X        else nop
  667. X        nextgad = gadnum.upperarg + 1
  668. X        if nextgad == 8 then nextgad = 1
  669. X        else nop
  670. X        call ActivateGadget(DIALWIN, nextgad)
  671. X     end
  672. X
  673. X      /*
  674. X       *   ...or baud has been selected
  675. X       */
  676. X     when thisarg == 'baud' then do
  677. X        if string=300 | string=1200 | string=2400 | string=4800 | string=9600 then do
  678. X           mod.baud = string
  679. X           modified = 1
  680. X           call ActivateGadget(DIALWIN, gadnum.baud+1)
  681. X        end
  682. X        else do
  683. X           r=Request(140, 40, "Invalid Baud rate. Baud rate must be\one of the following:\300, 1200, 2400, 4800, 9600",,"Okay")
  684. X           call ActivateGadget(DIALWIN, gadnum.baud)
  685. X        end
  686. X     end
  687. X      /*
  688. X       *   ...or Parity has been selected
  689. X       */
  690. X     when thisarg == 'parity' then do
  691. X        string = upper(string)
  692. X        if string='NONE' | string='MARK' | string='SPACE' | string='EVEN' | string='ODD' then do
  693. X           mod.parity = string
  694. X           modified = 1
  695. X           call ActivateGadget(DIALWIN, gadnum.parity+1)
  696. X        end
  697. X        else do
  698. X           r=Request(140, 40, "Invalid Parity. Parity must be\one of the following:\NONE, MARK, SPACE, EVEN, ODD",,"Okay")
  699. X           call ActivateGadget(DIALWIN, gadnum.parity)
  700. X        end
  701. X     end
  702. X
  703. X     otherwise do
  704. X        say thisarg
  705. X     end
  706. X      end
  707. X   end
  708. X   else nop
  709. Xend
  710. Xreturn ret
  711. X
  712. X/*
  713. X * Format fields
  714. X */
  715. X
  716. Xformatmod: procedure expose mod.
  717. Xmod.names   = left(strip(mod.names), 25)
  718. Xmod.phones  = left(strip(mod.phones), 25)
  719. Xmod.baud    = left(strip(mod.baud), 4)
  720. Xmod.parity  = left(strip(mod.parity), 5)
  721. Xmod.prefix  = left(strip(mod.prefix), 25)
  722. Xmod.postfix = left(strip(mod.postfix), 25)
  723. Xmod.script  = left(strip(mod.script), 25)
  724. Xreturn
  725. END_OF_FILE
  726. if test 17156 -ne `wc -c <'dial.vt100'`; then
  727.     echo shar: \"'dial.vt100'\" unpacked with wrong size!
  728. fi
  729. # end of 'dial.vt100'
  730. fi
  731. echo shar: End of archive 1 \(of 1\).
  732. cp /dev/null ark1isdone
  733. MISSING=""
  734. for I in 1 ; do
  735.     if test ! -f ark${I}isdone ; then
  736.     MISSING="${MISSING} ${I}"
  737.     fi
  738. done
  739. if test "${MISSING}" = "" ; then
  740.     echo You have the archive.
  741.     rm -f ark[1-9]isdone
  742. else
  743.     echo You still need to unpack the following archives:
  744.     echo "        " ${MISSING}
  745. fi
  746. ##  End of shell archive.
  747. exit 0
  748. -- 
  749. Submissions to comp.sources.amiga and comp.binaries.amiga should be sent to:
  750.     amiga@cs.odu.edu    
  751. or    amiga@xanth.cs.odu.edu    ( obsolescent mailers may need this address )
  752. or    ...!uunet!xanth!amiga    ( very obsolescent mailers need this address )
  753.  
  754. Comments, questions, and suggestions s should be addressed to ``amiga-request''
  755. (only use ``amiga'' for submissions) at the above addresses.
  756.